﻿using System;
using Ewk.Math.Numerics.PositionalNumeralSystems;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Ewk.Math.Numerics.UnitTests.PositionalNumeralSystems
{
    [TestClass]
    public class FactorialTests
    {
        [TestMethod]
        public void When_a_Factorial_is_initialized_with_23_Then_the_value_of_the_Numbers_are_3_2_1()
        {
            var factorial = new Factorial(23);

            Assert.AreEqual("321", factorial.ToString());
            Assert.AreEqual(1, factorial.Numbers[0]);
            Assert.AreEqual(2, factorial.Numbers[1]);
            Assert.AreEqual(3, factorial.Numbers[2]);
        }

        [TestMethod]
        public void When_a_Factorial_is_initialized_with_21_Then_the_value_of_the_Numbers_are_3_1_1()
        {
            var factorial = new Factorial(21);

            Assert.AreEqual("311", factorial.ToString());
            Assert.AreEqual(1, factorial.Numbers[0]);
            Assert.AreEqual(1, factorial.Numbers[1]);
            Assert.AreEqual(3, factorial.Numbers[2]);
        }

        [TestMethod]
        public void When_a_Factorial_is_initialized_with_19_Then_the_value_of_the_Numbers_are_3_0_1()
        {
            var factorial = new Factorial(19);

            Assert.AreEqual("301", factorial.ToString());
            Assert.AreEqual(1, factorial.Numbers[0]);
            Assert.AreEqual(0, factorial.Numbers[1]);
            Assert.AreEqual(3, factorial.Numbers[2]);
        }

        [TestMethod]
        public void When_a_Factorial_is_initialized_with_24_Then_the_value_of_the_Numbers_are_1_0_0_0()
        {
            var factorial = new Factorial(24);

            Assert.AreEqual("1000", factorial.ToString());
            Assert.AreEqual(0, factorial.Numbers[0]);
            Assert.AreEqual(0, factorial.Numbers[1]);
            Assert.AreEqual(0, factorial.Numbers[2]);
            Assert.AreEqual(1, factorial.Numbers[3]);
        }

        [TestMethod]
        public void When_a_Factorial_is_initialized_with_47_Then_the_value_of_the_Numbers_are_1_3_2_1()
        {
            var factorial = new Factorial(47);

            Assert.AreEqual("1321", factorial.ToString());
            Assert.AreEqual(1, factorial.Numbers[0]);
            Assert.AreEqual(2, factorial.Numbers[1]);
            Assert.AreEqual(3, factorial.Numbers[2]);
            Assert.AreEqual(1, factorial.Numbers[3]);
        }
    }
}